package com.ikun.oss.adapter;

import com.ikun.oss.entity.FileInfo;
import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;
import java.util.List;


/**
 * @Description: 文件存储适配器
 * @Author: gqh
 * @Date: 2024/5/10 16:22
 */
public interface StorageAdapter {

    /**
     * @Description: 创建bucket桶
     * @Author: gqh
     * @Date: 2024/5/9 13:16
     */
    public void createBucket(String bucket);

    /**
     * @Description: 上传文件
     * @Author: gqh
     * @Date: 2024/5/9 13:16
     */
    public void uploadFile(MultipartFile uploadFile, String bucket, String objectName);


    /**
     * @Description: 列出所有桶
     * @Author: gqh
     * @Date: 2024/5/9 13:16
     */
    public List<String> getAllBucket();


    /**
     * @Description: 列出当前桶的所有文件
     * @Author: gqh
     * @Date: 2024/5/9 13:16
     */
    public List<FileInfo> getAllFile(String bucket);

    /**
     * @Description: 下载文件
     * @Author: gqh
     * @Date: 2024/5/9 21:10
     */
    public InputStream downLoad(String bucket, String objectName);

    /**
     * @Description: 删除文件
     * @Author: gqh
     * @Date: 2024/5/9 21:12
     */
    public void deleteBucket(String bucket) throws Exception;

    /**
     * @Description: 删除文件
     * @Author: gqh
     * @Date: 2024/5/9 21:13
     */
    public void deleteObject(String bucket, String objectName);

}
